import 'dart:convert';

import 'package:freedom/const/game_const.dart';
import 'package:freedom/entity/user_entity_info.dart';

import 'cache_util.dart';

class UserUtil {
  static UserEntityInfo? getUserInfo() {
    String? userInfoCache =
        CacheUtil.preferencesInstance!.getString(CacheConst.userInfo);
    if (userInfoCache == null) {
      return null;
    }
    return UserEntityInfo.fromJson(Map.castFrom(json.decode(userInfoCache)));
  }
}
